const Router = require('koa-router')
const fileValidate = require('@/middlewares/validateMiddlewares/fileValidate')
const fileController = require('@/controller/fileController')
const { verifyToken } = require('@/utils/jwt')
const { verifyAdmin } = require('@/middlewares/validateMiddlewares/verifyAdmin')

const router = new Router()

/**
 * 文件上传协商接口
 */

router.post(
  '/handshark',
  verifyToken(),
  verifyAdmin(),
  fileValidate.fileSharkValidate,
  fileController.fileHandShark
)

/**
 * 文件分片上传接口
 */

router.post(
  '/upload',
  verifyToken(),
  verifyAdmin(),
  fileValidate.chunkUploadValidate,
  fileController.chunkUpload
)

module.exports = router
